package altanovela.interceptor;

import java.util.Map;

import altanovela.action.MainController;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class MainInterceptor extends AbstractInterceptor{ 
	public Map session;
	
	@Override
	public String intercept(ActionInvocation inv) throws Exception {
		session = ActionContext.getContext().getSession();
		String hisname = (String) session.get("login");
		if(hisname != null){
			MainController.setName(hisname);
			return MainController.homePage;
		}
		return inv.invoke();
	}
}
